package com.ttxs.generator.util;

import com.baomidou.mybatisplus.generator.config.po.TableField;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;

public class TableInfoUtils {
    public static boolean isCompositeKey(TableInfo tableInfo) {
        boolean composited = false;
        if (tableInfo.isHavePrimaryKey()) {
            int keyCount = 0;
            for (TableField field : tableInfo.getFields()) {
                if (field.isKeyFlag()) {
                    keyCount++;
                }
            }
            composited = keyCount > 1;
        }
        return composited;
    }
}
